package com.xyht.medicine_management_system.modules.kuaidi.controller;


import com.xyht.medicine_management_system.common.commonReturn.ResponseResult;
import com.xyht.medicine_management_system.common.desEncodeAndDecode.annotation.SecretBody;
import com.xyht.medicine_management_system.modules.kuaidi.entity.req.MmsKuaidiCompanyReq;
import com.xyht.medicine_management_system.modules.kuaidi.entity.req.MmsKuaidiInfoBatchReq;
import com.xyht.medicine_management_system.modules.kuaidi.service.MmsKuaidiCompanyService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 * 快递公司 前端控制器
 * </p>
 *
 * @author XYHT
 * @since 2024-07-03
 */
@RestController
@RequestMapping("/kuaidi/company")
@SecretBody
public class MmsKuaidiCompanyController {
    @Resource
    private MmsKuaidiCompanyService mmsKuaidiCompanyService;

    @ApiOperation("添加快递公司")
    @PostMapping("/add")
    public ResponseResult addKuaidiCompany(@RequestBody MmsKuaidiCompanyReq companyReq) {
        return mmsKuaidiCompanyService.addKuaidiCompany(companyReq);
    }

    @ApiOperation("修改快递公司")
    @PostMapping("/update")
    public ResponseResult updateKuaidiCompany(@RequestBody MmsKuaidiCompanyReq companyReq) {
        return mmsKuaidiCompanyService.updateKuaidiCompany(companyReq);
    }

    @ApiOperation("删除快递公司")
    @PostMapping("/delete")
    public ResponseResult deleteKuaidiCompany(@RequestBody MmsKuaidiCompanyReq companyReq) {
        return mmsKuaidiCompanyService.deleteKuaidiCompany(companyReq);
    }

    @ApiOperation("获取快递公司列表")
    @GetMapping("/list")
    public ResponseResult getKuaidiCompanyList(@RequestParam(value = "searchStr", required = false) String searchStr,
                                               @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                               @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
        return mmsKuaidiCompanyService.getKuaidiCompanyList(searchStr, pageNum, pageSize);
    }


}

